/*
 * Copyright (c) 2009 Enio Perpetuo
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * 		http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 *  
 */
package co.za.gvi.smart;

/**
 * This class represents a <code>VCard</code> which is a file 
 * format standard for electronic business cards.
 * 
 * @author Enio Perpetuo
 */
public class VCard extends SmartMessage {
	
	private String version = "3.0";
	private String name;
	private String title;
	private String workAddress;
	private String homeAddress;
	private String workTelephoneNumber;
	private String homeTelephoneNumber;
	private String cellularNumber;
	private String email;
	private String organization;
	private String geo;
	
	/**
	 * Set the name
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Set the title
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Set the work address
	 * @param workAddress the workAddress to set
	 */
	public void setWorkAddress(String workAddress) {
		this.workAddress = workAddress;
	}

	/**
	 * Set the home address
	 * @param homeAddress the homeAddress to set
	 */
	public void setHomeAddress(String homeAddress) {
		this.homeAddress = homeAddress;
	}

	/**
	 * Set the work telephone number
	 * @param workTelephoneNumber the workTelephoneNumber to set
	 */
	public void setWorkTelephoneNumber(String workTelephoneNumber) {
		this.workTelephoneNumber = workTelephoneNumber;
	}

	/**
	 * Set the home telephone number
	 * @param homeTelephoneNumber the homeTelephoneNumber to set
	 */
	public void setHomeTelephoneNumber(String homeTelephoneNumber) {
		this.homeTelephoneNumber = homeTelephoneNumber;
	}

	/**
	 * Set the cellular number
	 * @param cellularNumber the cellularNumber to set
	 */
	public void setCellularNumber(String cellularNumber) {
		this.cellularNumber = cellularNumber;
	}

	/**
	 * Set the email address
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * Set the organization
	 * @param organization the organization to set
	 */
	public void setWebsite(String organization) {
		this.organization = organization;
	}

	/**
	 * Set the geo location
	 * @param latitude the latitude to set
	 * @param longitude the longitude to set
	 */
	public void setGeo(String latitude, String longitude) {
		this.geo = latitude + ", " + longitude;
	}
	
	/**
	 * Set the version
	 * @param version the version to set
	 */
	public void setVersion(String version) {
		this.version = version;
	}

	@Override
	public String toString() {
		this.builder = new StringBuilder();

		builder.append("BEGIN:VCARD");
		builder.append(CRLF);
		
		append(this.version,				"VERSION:");
		append(this.name, 					"FN:");
		append(this.title, 					"TITLE:");
		append(this.workAddress, 			"ADR;WORK:");
		append(this.homeAddress, 			"ADR;HOME:");
		append(this.workTelephoneNumber, 	"TEL;WORK:");
		append(this.homeTelephoneNumber, 	"TEL;HOME:");
		append(this.cellularNumber, 		"TEL;CELL:");
		append(this.email, 					"EMAIL;INTERNET:");
		append(this.organization,			"ORG:");
		append(this.geo, 					"GEO:");
		
		builder.append("END:VCARD");
		builder.append(CRLF);
		
		return builder.toString();
	}
}
